package handler

import (
	"github.com/henrylee2cn/faygo"
	"hq/test/model"
)

/*
Index
*/
var Index = faygo.HandlerFunc(func(ctx *faygo.Context) error {
	return ctx.Render(200, faygo.JoinStatic("index.html"), faygo.Map{
		"TITLE":   "faygo",
		"VERSION": faygo.VERSION,
		"CONTENT": "Welcome To Faygo",
		"AUTHOR":  "HenryLee",
	})
})


var Admin = faygo.HandlerFunc(func(ctx *faygo.Context) error {
	admin := new(model.Admin)
	admin.Query().Where("id > 1").Get(admin)
	return ctx.JSON(200,faygo.Map{
		"admin":admin,
	})
})
